﻿using AntMovement.Core.Enum;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace AntMovement.WPF.Converter
{
    [ValueConversion(typeof(string), typeof(MaterialDesignThemes.Wpf.PackIconKind))]
    public class MessageLevelToPIconConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return MaterialDesignThemes.Wpf.PackIconKind.Info;
            }

            switch (Tool.StringToLogLevel.ToLogLevel(value))
            {
                case LogLevel.Info: return MaterialDesignThemes.Wpf.PackIconKind.InformationVariantBoxOutline;
                case LogLevel.Success: return MaterialDesignThemes.Wpf.PackIconKind.CheckCircle;
                case LogLevel.Warning: return MaterialDesignThemes.Wpf.PackIconKind.Alert;
                case LogLevel.Error: return MaterialDesignThemes.Wpf.PackIconKind.StickerRemoveOutline;
                default: return MaterialDesignThemes.Wpf.PackIconKind.Info;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
